Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lazy promise transitions #331

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

dfarr
Copy link
Member

@dfarr dfarr commented May 17, 2024

A promise cannot be guarenteed to be transitioned from pending to timedout when requests come in after the timeout time. To compensate for this, we lazily transition promises on request if we see that the promise should be timedout, but is not. This rarely taken code path had two bugs.

  1. On create promise request, a promise that is lazily timedout should return a 200 if strict is false and the idempotency keys match.

  2. On complete promise request, a promise that is lazily timedout should return a 200 if strict is false.

This PR also introduces a lazy scenario to DST to test the lazy code path. When this scenario is executed, we disable the time out promises coroutine and search promises request.

A promise cannot be guarenteed to be transitioned from pending to
timedout when requests come in after the timeout time. To
compensate for this, we lazily transition promises on request if
we see that the promise should be timedout, but is not. This
rarely taken code path had two bugs.

1. On create promise request, a promise that is lazily timedout
   should return a 200 if strict is false and the idempotency keys
   match.

2. On complete promise request, a promise that is lazily timedout
   should return a 200 if strict is false.

This PR also introduces a lazy scenario to DST to test the lazy
code path. When this scenario is executed, we disable the time out
promises coroutine and search promises request.
Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 55.99%. Comparing base (9f31bbe) to head (6ea0cdd).

Files Patch % Lines
test/dst/model.go 44.44% 2 Missing and 3 partials ⚠️
internal/app/coroutines/completePromise.go 50.00% 1 Missing and 1 partial ⚠️
internal/app/coroutines/createPromise.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #331      +/-   ##
==========================================
+ Coverage   55.34%   55.99%   +0.64%     
==========================================
  Files         113      113              
  Lines        9885     9892       +7     
==========================================
+ Hits         5471     5539      +68     
+ Misses       4052     3987      -65     
- Partials      362      366       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dfarr dfarr merged commit 4875c84 into main May 20, 2024
4 of 5 checks passed
@dfarr dfarr deleted the fix/lazy-timeout-promise-transitions branch May 20, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant